package com.aspose.cells.b.a;

public class zq {
   private static final double[] a = new double[]{1.0D, 10.0D, 100.0D, 1000.0D, 10000.0D, 100000.0D, 1000000.0D, 1.0E7D, 1.0E8D, 1.0E9D, 1.0E10D, 1.0E11D, 1.0E12D, 1.0E13D, 1.0E14D, 1.0E15D};

   public static double a(double var0, int var2, int var3) {
      return b(var0, var2);
   }

   public static double a(double var0, int var2) {
      return b(var0, 8);
   }

   public static double a(double var0, double var2) {
      if (var2 == 1.0D) {
         return Double.NaN;
      } else {
         return var0 == 1.0D || var2 != 0.0D && var2 != Double.POSITIVE_INFINITY ? Math.log(var0) / Math.log(var2) : Double.NaN;
      }
   }

   public static long a(double var0) {
      if (var0 == (double)((long)var0)) {
         return (long)var0;
      } else {
         return var0 > 0.0D ? (long)(var0 + 0.5D) : (long)(var0 - 0.5D);
      }
   }

   public static double b(double var0, int var2) {
      int var3 = zn.a(var0);
      if (var3 >= 15) {
         return var0;
      } else {
         var2 = Math.min(15 - var3, var2);
         double var4 = a[var2];
         var0 *= var4;
         var0 = b(var0);
         var0 = (double)a(var0);
         var0 /= var4;
         return var0;
      }
   }

   public static double b(double var0) {
      int var2 = zn.a(var0);
      if (var2 >= 15) {
         return var0;
      } else {
         byte var3 = 13;
         int var6 = Math.min(15 - var2, var3);
         double var4 = a[var6];
         var0 *= var4;
         var0 = (double)a(var0);
         var0 /= var4;
         return var0;
      }
   }
}
